<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>01.新生命周期</title>
    <script src="../js/react.development.js"></script>
    <script src="../js/react-dom.development.js"></script>
    <script src="../js/babel.min.js"></script>
  </head>
  <body>
    <div id="test"></div>

    <script type="text/babel">
      class Demo extends React.Component {
        getDerivedStateFromProps(props, state) {
          console.log(props, state);
          console.log("getDerivedStateFromProps");
        }

        render() {
          return (
            <div>
              <h2>num的值</h2>
            </div>
          );
        }
      }
    </script>
  </body>
</html>
